<template>
	<view>
		<view class="uni-title" :style="{ padding: padding ? '20rpx' : '', background: background }">
			<view>
				<span></span>
				<span>{{ title }}</span>
			</view>
			<view v-if="url" class="more" @click="more" :style="{ color: btncolor }">
				<span>{{ btnText }}</span>
				<uni-icons type="forward" size="16" :color="btncolor"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		title: {
			type: String,
			default: ''
		},
		url: {
			type: String,
			default: ''
		},
		urltype: {
			//1，默认跳一级页面    2，跳二级页面（没有底栏）
			type: String,
			default: '1'
		},
		padding: {
			type: Boolean,
			default: false
		},
		background: {
			type: String,
			default: ''
		},
		btnText: {
			type: String,
			default: '更多'
		},
		btncolor: {
			type: String,
			default: '#bbb'
		}
	},
	data() {
		return {};
	},
	methods: {
		more() {
			if (this.url) {
				if (this.urltype != 1) {
					console.log('二级页面');
					// uni.switchTab({
					// 	url: '/pages/my/my'
					// });
				} else {
					uni.switchTab({
						url: this.url
					});
					uni.setStorage({
						key: 'stitleDate',
						data: this.title,
						success: function() {
							console.log('success');
						}
					});
				}
			}
		}
	}
};
</script>

<style lang="scss">
.uni-title {
	display: flex;
	justify-content: space-between;
	margin-top: 10rpx;
	.more {
		font-size: 14px;
	}
}
</style>
